#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
const int basesize = 1024;
char Intputarr[basesize];
char Outputarr[basesize];




int main()
{
    int num = 12345;
    snprintf(Intputarr,basesize,"%d\n",num);
    write(1,Intputarr,basesize);
    // write(1,&num,sizeof(num)); 
    // printf("\n");
    return 0;
}

// int main()
// {
//     int fd1 = open("log1.txt",O_WRONLY | O_TRUNC | O_CREAT,0666);
//     int fd2 = open("log2.txt",O_WRONLY | O_TRUNC | O_CREAT,0666);
//     int fd3 = open("log3.txt",O_WRONLY | O_TRUNC | O_CREAT,0666);
//     int fd4 = open("log4.txt",O_WRONLY | O_TRUNC | O_CREAT,0666);
//     printf("fd1: %d\n", fd1);
//     printf("fd2: %d\n", fd2);
//     printf("fd3: %d\n", fd3);
//     printf("fd4: %d\n", fd4);

//     write(fd1,"hello world!\n",12);
//     write(fd2,"hello world!\n",12);
//     write(fd3,"hello world!\n",12);
//     write(fd4,"hello world!\n",12);
//     return 0;
// }















//int main()
//{
//    int fd = open("log.txt",O_RDONLY);
//    read(fd,Intputarr,basesize);
//    Intputarr[strlen(Intputarr)] = 0;
//    printf("read file: %s\n", Intputarr);
//    close(fd);
//    return 0;
//}




































//int main()
//{
//    FILE* pf = fopen("log.txt","a+");
//    if (pf == NULL) 
//    {
//        perror("fopen");
//    }
//    char Intputarr[basesize] = {"aaaa"};
//    fwrite(Intputarr,1,strlen(Intputarr),pf);
//    fclose(pf);
//    return 0;
//}
